<?php
/** 
 * $Source: /cvsroot/pn-commerce/pn-commerce/pntemplates/plugins/function.pncGetItemsByCategory.php,v $
 * $Author: pcornelissen $
 * $Revision: 1.2 $
 * $Date: 2003/12/08 12:09:47 $
 *
 * Type: Function
 *
 * gets an item from the db and assign the item array to a given name
 * @param  CategoryID : get the items of this category
 * @param          assign  : name of variable to assign the item array to. If assign is not set, we will use 'items'
 */
function smarty_function_pncGetItemsByCategory($params, &$smarty)
{
    extract($params);
    if( !pnModLoad( 'pncommerce', 'user' ) )
    {
        return false;
    }

    if ( !pnModAPILoad( 'pncommerce', 'user' ) )
    {
        return false;
    }

    if( !$assign )
    {
        $assign = 'Items';
    }

    $items = pnModAPIFunc( 'pncommerce', 'user', 'getItemsByCategory',
                              array( 'CategoryID' => $CategoryID ) );
    $smarty->assign( $assign, $items );
}
?>
